From: Tim Deegan Date: Thu, 12 Jan 2012 16:39:05 +0000 (+0000) Subject: x86/mm: Fix operator associativity bug in mm-locks.h X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=e4dbfcfe9d63087affb09c41dce0e069dc45d7bc;p=xen.git x86/mm: Fix operator associativity bug in mm-locks.h In an order-enforcing wrapper for an "external" recursive lock, we aim to increment/decrement a recurse count and only update the lock ordering on zero counts. Unfortunately we incrementing/decrementing the pointer to the recurse count, rather than the count itself. Signed-off-by: Andres Lagar-Cavilla Acked-by: Tim Deegan Committed-by: Tim Deegan --- diff --git a/xen/arch/x86/mm/mm-locks.h b/xen/arch/x86/mm/mm-locks.h index 738b27c6c7..058de9a943 100644 --- a/xen/arch/x86/mm/mm-locks.h +++ b/xen/arch/x86/mm/mm-locks.h @@ -81,7 +81,7 @@ static inline void _mm_enforce_order_lock_post(int level, int *unlock_level, { if ( recurse_count ) { - if ( *recurse_count++ == 0 ) + if ( (*recurse_count)++ == 0 ) { *unlock_level = __get_lock_level(); } @@ -125,7 +125,7 @@ static inline void mm_enforce_order_unlock(int unlock_level, if ( recurse_count ) { BUG_ON(*recurse_count == 0); - if ( *recurse_count-- == 1 ) + if ( (*recurse_count)-- == 1 ) { __set_lock_level(unlock_level); }